<?php

class Loginmodel extends CI_Model
{
  public function __construct()
   {
     $this->load->database();
   }
  
	public function login()
	{
	  $this->load->helper('url');
	  
//	  $slug = url_title($this->input->post('title'), 'dash', TRUE);
	  $data = array(
	    'acc'   => $this->input->post('accout'),
	    'pwd'   => $this->input->post('password'),
	  );
	 
	  $strSql = 'SELECT * FROM account WHERE acc ='."'".$data['acc']."'";

	  $query = $this->db->query($strSql);
		if ($query->num_rows() > 0)
		{
 		  $row = $query->row_array(); 
		} 
	  
	  if (!empty($row))
	  {
	  	if ($row['pwd'] == $data['pwd'])
	  	{
	  		return TRUE;
	  	}
	  	
	  }
	  
	  return FALSE;
	}
}
